From a3b5920658db7922539fd5155250e921b7f61078 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 1 Oct 2014 18:41:06 +0200 Subject: [PATCH] Add configure --with-initddir=DIR Preserve existing behaviour: Fedora gets rc.d/init.d, BSD gets rc.d, everyone else gets init.d. Signed-off-by: Olaf Hering Acked-by: Ian Campbell Cc: Ian Campbell Cc: Ian Jackson Cc: Stefano Stabellini Cc: Wei Liu [ ijc -- ran autogen.sh as requested ] --- Config.mk | 1 - config/Paths.mk.in | 1 + configure | 31 +++++++++++++++++++++++++++++++ docs/misc/distro_mapping.txt | 5 +++-- m4/paths.m4 | 20 ++++++++++++++++++++ tools/configure | 27 +++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 3 deletions(-) diff --git a/Config.mk b/Config.mk index 2bb8dcca1b..e4ff64d3a1 100644 --- a/Config.mk +++ b/Config.mk @@ -76,7 +76,6 @@ endef # See distro_mapping.txt for other options $(eval $(call setvar_dir,CONFIG_LEAF_DIR,,/etc/sysconfig,sysconfig,default)) -$(eval $(call setvar_dir,INITD_DIR,/etc,/rc.d/init.d,/rc.d/init.d,/init.d)) ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include diff --git a/config/Paths.mk.in b/config/Paths.mk.in index 507b6d1744..c01d0ef449 100644 --- a/config/Paths.mk.in +++ b/config/Paths.mk.in @@ -24,6 +24,7 @@ XEN_LOG_DIR := @XEN_LOG_DIR@ XEN_LIB_STORED := @XEN_LIB_STORED@ CONFIG_DIR := @CONFIG_DIR@ +INITD_DIR := @INITD_DIR@ XEN_LOCK_DIR := @XEN_LOCK_DIR@ XEN_PAGING_DIR := @XEN_PAGING_DIR@ diff --git a/configure b/configure index 68e6eb00b2..7a3d444232 100755 --- a/configure +++ b/configure @@ -598,6 +598,7 @@ XEN_PAGING_DIR XEN_LOCK_DIR XEN_SCRIPT_DIR XEN_CONFIG_DIR +INITD_DIR CONFIG_DIR XENFIRMWAREDIR PRIVATE_BINDIR @@ -660,6 +661,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +with_initddir enable_xen enable_tools enable_stubdom @@ -1289,6 +1291,12 @@ Optional Features: --enable-stubdom Enable build and install of stubdom --disable-docs Disable build and install of docs +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-initddir=DIR Path to directory with sysv runlevel scripts. + [SYSCONFDIR/init.d] + Report bugs to . Xen Hypervisor home page: . _ACEOF @@ -1870,6 +1878,26 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then esac fi + +# Check whether --with-initddir was given. +if test "${with_initddir+set}" = set; then : + withval=$with_initddir; initddir_path=$withval +else + case "$host_os" in + *linux*) + if test -d $sysconfdir/rc.d/init.d ; then + initddir_path=$sysconfdir/rc.d/init.d + else + initddir_path=$sysconfdir/init.d + fi + ;; + *) + initddir_path=$sysconfdir/rc.d + ;; + esac +fi + + BINDIR=$prefix/bin @@ -1909,6 +1937,9 @@ XENFIRMWAREDIR=$prefix/lib/xen/boot CONFIG_DIR=$sysconfdir +INITD_DIR=$initddir_path + + XEN_CONFIG_DIR=$CONFIG_DIR/xen diff --git a/docs/misc/distro_mapping.txt b/docs/misc/distro_mapping.txt index f849d07007..0e8bf0cebd 100644 --- a/docs/misc/distro_mapping.txt +++ b/docs/misc/distro_mapping.txt @@ -13,8 +13,9 @@ build host, via the "setvar_dir" macro in Config.mk) and for some scripts at run-time. If the Red Hat directory exists, it is used; otherwise the Debian one is used. -You can override this by setting the variables in the environment or -your ".config" (which is included by .config). +The INITD_DIR path can be changed with configure --with-initddir=DIR. +The CONFIG_LEAF_DIR path can be changed by setting the variables in +the environment or your ".config" (which is included by Config.mk). To add support for new distributions that don't use the above locations, one must grep for the above elements and add appropriate checks. diff --git a/m4/paths.m4 b/m4/paths.m4 index b183845c5d..19b64816b4 100644 --- a/m4/paths.m4 +++ b/m4/paths.m4 @@ -22,6 +22,23 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then esac fi +AC_ARG_WITH([initddir], + AS_HELP_STRING([--with-initddir=DIR], + [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]), + [initddir_path=$withval], + [case "$host_os" in + *linux*) + if test -d $sysconfdir/rc.d/init.d ; then + initddir_path=$sysconfdir/rc.d/init.d + else + initddir_path=$sysconfdir/init.d + fi + ;; + *) + initddir_path=$sysconfdir/rc.d + ;; + esac]) + BINDIR=$prefix/bin AC_SUBST(BINDIR) @@ -63,6 +80,9 @@ AC_SUBST(XENFIRMWAREDIR) CONFIG_DIR=$sysconfdir AC_SUBST(CONFIG_DIR) +INITD_DIR=$initddir_path +AC_SUBST(INITD_DIR) + XEN_CONFIG_DIR=$CONFIG_DIR/xen AC_SUBST(XEN_CONFIG_DIR) diff --git a/tools/configure b/tools/configure index fe44b4e643..b61d3e4c01 100755 --- a/tools/configure +++ b/tools/configure @@ -711,6 +711,7 @@ XEN_PAGING_DIR XEN_LOCK_DIR XEN_SCRIPT_DIR XEN_CONFIG_DIR +INITD_DIR CONFIG_DIR XENFIRMWAREDIR PRIVATE_BINDIR @@ -783,6 +784,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile +with_initddir enable_githttp enable_monitors enable_ocamltools @@ -1472,6 +1474,8 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-initddir=DIR Path to directory with sysv runlevel scripts. + [SYSCONFDIR/init.d] --with-system-qemu[=PATH] Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen device model instead of building @@ -3709,6 +3713,26 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then esac fi + +# Check whether --with-initddir was given. +if test "${with_initddir+set}" = set; then : + withval=$with_initddir; initddir_path=$withval +else + case "$host_os" in + *linux*) + if test -d $sysconfdir/rc.d/init.d ; then + initddir_path=$sysconfdir/rc.d/init.d + else + initddir_path=$sysconfdir/init.d + fi + ;; + *) + initddir_path=$sysconfdir/rc.d + ;; + esac +fi + + BINDIR=$prefix/bin @@ -3748,6 +3772,9 @@ XENFIRMWAREDIR=$prefix/lib/xen/boot CONFIG_DIR=$sysconfdir +INITD_DIR=$initddir_path + + XEN_CONFIG_DIR=$CONFIG_DIR/xen -- 2.30.2